/*************************************************************************
	> File Name: Builder.cc
	> Author: Joker
	> Mail: mahongtao@foxmail.com 
	> Created Time: 2020-09-21 20:18:22
 ************************************************************************/

#include "Builder.h"

#include <iostream>

using std::cout;
using std::endl;

void ConcreateBuilder1::BuilderPartA(){
    cout << "BuilderPartA by ConcreateBuilder1" << endl;  
}

void ConcreateBuilder1::BuilderPartB(){
    cout << "BuilderPartB by ConcreateBuilder1" << endl;
}

void ConcreateBuilder2::BuilderPartA(){
    cout << "BuilderPartA by ConcreateBuilder2" << endl;
}

void ConcreateBuilder2::BuilderPartB(){
    cout << "BuilderPartB by ConcreateBuilder2" << endl;
}

Director::Director(Builder * pBuilder)
    :_pBuilder(pBuilder)
{
    cout << "Director(Builder *)" << endl;
}

Director::~Director(){
    cout << "~Director()" << endl;
    delete _pBuilder;
    _pBuilder = nullptr;
}

void Director::Construct(){
    _pBuilder->BuilderPartA();
    _pBuilder->BuilderPartB();
}
